#include <head.h>
#include <string.h>
#define SIZE(x) sizeof(x)/sizeof(x[0])
char **serverdatabk(char *filename){
    //以下是将server.conf的内容读入serverdata数组中，然后将IP、端口号、线程数传给server
    char tempdata[1024]={0};
    int src=open(filename,O_RDONLY);
    ERROR_CHECK(src,-1,"open");
    read(src,tempdata,sizeof(tempdata));
    
    
    //printf("tempdata:%s",tempdata);

    char *pchStrTmpIn=NULL;
    
    char *pchTmp=NULL;
    char **serverdata=(char **)calloc(3,sizeof(char **));
    pchTmp = tempdata;
    int i=0;
    while(NULL != ( serverdata[i]= strtok_r( pchTmp," ", &pchStrTmpIn) )){
        //为什么调用sprintf会出问题？
        //sprintf(serverdata[i],"%s",pchTmp);
        //printf("serverdata[%d]:%s\n",i,serverdata[i]);
        
        //printf("pchTmp:%s\n",pchTmp);
        i++;
        if(i==3)
            break;
        pchTmp=NULL;
    } 
    close(src);
    //到上一行，参数转换成功
    return serverdata;
}

